It either gets created when ( q= someone creates an instance within any software aspect) or ( w= someone calls a stores _getLTSD function) or ( e= a store interface aspect calls the _getLTSDStoreSpecific function)

So when a user performs w, I want to add that data to the _instanciatedData so that if someone else performs w later, it will return the same object in memory and not create a new one. If someone performs q then I wish this to be saved too

When all of the references to an object obtained in a software aspect by calling q or w go out of scope then I wish for the stores reference to be deleted along with its entry within the _instanciatedData structure. So unversioned data is stored in the base dict and versioned data is stored within a list held within the base dict

  • So when adding object to the _instanciatedData dict, we should instead use weakrefs. This is not the end of our task as we still need to remove entries from this structure when they have been garbage collected So we need a method of doing this, the weakref constructor takes a callback argument which it seems like we can use, the finalize class could also be usefull. Considering we are using weakrefs, del could also be useful. As the docs mention, finalize is a better choice than del due to the dependance of del on the interpreter implementation. So ref callback vs finalize

Ref callback is called when the object is about to be finalized Finalize is an equivelant of a weakref but the callback appears to take arguments one

Although the weakref.ref callback is passed the ref, it is dead by the time the callback gets it

  • So set the callback to one that will remove it from _instanciatedData

  • Need to call finalize.peek()[ 0] when retrieving from the store

  • Is e affected by this change?, no i dont think so


An old note I found in the _deleteData function:

"""
OBSCOMMENT What should deleting data do? We have a concept of a singular piece of data. This piece can be located within the long term store
and it can also be located in ram accessed by python software.
When we delete data it seems obvious to remove it from the long term store but what is less obvious is whether to remove the in memory
representation. The main concern is the interests of other software aspects that may be interacting with that data, should they be notified?
If we delete the ram data without notifying then it may cause other software aspects to fail
If we dont then this may break a concept worth following, it may be resaved
I think either, notify so other aspects can stop doing shit then delete it, or we do nothing

for now just remove from long term store
"""